/*
 * @Author: qianmingtian
 * @Date: 2020-07-07 10:06:28
 * @LastEditors: qianmingtian
 * @LastEditTime: 2020-07-07 14:42:06
 * @FilePath: \qianmingtian.github.io\code\java\abstractPrac\InterfaceTest.java
 */
package abstractPrac;

/**
 * 接口中只包含常量+抽象方法
 */
interface MyMath {
    public static final int PIP = 34234;

    int PIPI = 34234;

    public abstract int sum(int a, int b);

    // public abstract 修饰符可以省略
    int sub(int a, int b);

    // 接口中的方法是抽象方法,不能有方法体
    // int doSome(){

    // }

}

class MyImplement implements MyMath {

    @Override
    public int sub(int a, int b) {
        // TODO Auto-generated method stub
        return a - b;

    }

    @Override
    public int sum(int a, int b) {
        // TODO Auto-generated method stub
        return a + b;

    }

}

interface E {

}

interface K {

}

class M implements E, K {

}

public class InterfaceTest {
    public static void main(String[] args) {
        System.out.println(MyMath.PIP);
        // MyMath.PIP = 232;

        // 接口
        E e = new M();
        if (e instanceof K) {
            K k = (K) e;
        }
    }
}/*
  * @Author: qianmingtian
  * 
  * @Date: 2020-07-07 10:06:28
  * 
  * @LastEditors: qianmingtian
  * 
  * @LastEditTime: 2020-07-07 10:06:28
  * 
  * @FilePath: \qianmingtian.github.io\code\java\abstractPrac\InterfaceTest.java
  */
